import { useEffect, useState } from 'react'

const TestUseEffect = () => {
  const [sw, setSwitch] = useState(false)
  useEffect(() => {
    console.log(sw)
  }, [sw])

  return (
    <div style={{ border: '1px solid red' }}>
      <span>测试useEffect执行</span>
      <button onClick={() => setSwitch(!sw)}>切换</button>
    </div>
  )
}

export default TestUseEffect
